--尽精求巧
local jinjingqiuqiao = fk.CreateSkill {
    name = "mcdh_jinjingqiuqiao",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

jinjingqiuqiao:addEffect(fk.HpChanged,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self) and player == target
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        player:drawCards(3, self.name)
        if player:getHandcardNum() >= 2 then
            local _, result = room:askForUseActiveSkill(
                    player,
                    "mcdh_jinjingqiuqiao_active",
                    "#mcdh_jinjingqiuqiao-discard",
                    false
            )
            if result then
                room:throwCard(result.cards, self.name, player, player)
            end
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_jinjingqiuqiao"] = "益巧",
    [":mcdh_jinjingqiuqiao"] = "『尽精求巧』<br>当你的体力变化后，你可以摸三张牌，然后弃置两张颜色相同的牌。",
}

return jinjingqiuqiao